#转换为16进制数
#ref:Ｐython实现"数字转换为十六进制"的两种方法
#https://blog.csdn.net/qiubingcsdn/article/details/83079235
def toHex(num):
    chaDic = {10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f'}
    hexStr = ""        
    if num < 0:
        num = num + 2 ** 32        
    while num >= 16:
        digit = num % 16
        hexStr = chaDic.get(digit, str(digit)) + hexStr
        num //= 16 # //运算符执行地板除法(向下取整除),它会返回整除结果的整数部分
    hexStr = chaDic.get(num, str(num)) + hexStr
            
    return hexStr

strMsg = 'fjAkEee66e明白EkCECEHY544ll立项' #元字符串
#分成4个字节一组
#若消息字符串不为l的整数倍，则在后边补’0’.
while (len(strMsg) % 4 != 0):
    strMsg = strMsg + '0'
strList = []
for i in range(0,len(strMsg),4):
    strList.append(strMsg[i:i + 4])
print(strList)

hashValue = strList[0]
for j in range(1,len(strList),1):
    str1 = ''
    for j2 in range(0,4):
        str1 = str1 + chr(ord(hashValue[j2]) ^ ord(strList[j][j2]))
        #ord()返回对应的 ASCII 数值，或者 Unicode 数值
    hashValue = str1

hashValueHex = ''
for k in range(0,len(hashValue),1):
    hashValueHex = hashValueHex + toHex(ord(hashValue[k]))
print(hashValueHex)